import java.util.HashSet;
import java.util.Set;

public class Solution929 {
    public int numUniqueEmails(String[] emails) {
        Set<String> set=new HashSet<>();
        for (String email : emails) {
            int t=email.indexOf('@');
            String temp=email.substring(0,t);
            temp=temp.replace(".","");
            int tt=temp.indexOf('+');
            if (tt!=-1){
                temp=temp.substring(0,tt);
            }
            set.add(temp.concat("@").concat(email.substring(t+1)));
        }
        return set.size();
    }

    public static void main(String[] args) {
        System.out.println(new Solution929().numUniqueEmails(new String[]{"test.email+alex@leetcode.com","test.email.leet+alex@code.com"}));
    }
}
